import Cookies from 'js-cookie'

const TokenKey = 'todo_token'
const EmailKey = 'user_email'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token, expiresInDays) {
  return Cookies.set(TokenKey, token, { expires: expiresInDays || 1 })
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getEmail() {
  return Cookies.get(EmailKey)
}

export function setEmail(email, expiresInDays) {
  return Cookies.set(EmailKey, email, { expires: expiresInDays || 1 })
}

export function removeEmail() {
  return Cookies.remove(EmailKey)
}
